package com.sq.partner.manager.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.sq.partner.manager.common.Config;

public class JDBCUtil {
	private static Logger logger = LogUtil.getLog(JDBCUtil.class);
	public static Connection JDBC() throws SQLException {
		Connection conn = null;
		try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			logger.error(e);
		}
//		String url = "jdbc:oracle:thin:@10.196.12.22:1521:uatora";
//		conn = DriverManager.getConnection(url, "preprod_user", "oracle");
//		String url = "jdbc:oracle:thin:@10.192.56.87:1521:pts1";
//		conn = DriverManager.getConnection(url, "PNUSER", "PnPts0");
		conn = DriverManager.getConnection( Config.getProp("jdbc.url2"), Config.getProp("jdbc.username2"), Config.getProp("jdbc.password2"));
		return conn;
	}

	

	public static void close(Connection conn, PreparedStatement pst,
			ResultSet rs) {
		if (rs != null) {
			try {
				rs.close();
			} catch (SQLException e) {
				logger.error(e);
			}
		}
		if (pst != null) {
			try {
				pst.close();
			} catch (SQLException e) {
				logger.error(e);
			}
		}
		if (conn != null) {
			try {
				conn.close();
			} catch (SQLException e) {
				logger.error(e);
			}
		}
	}

	

	public static void main(String[] args)  {
		
	}
}
